package com.suitsoft.ut.entity.base;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;

import com.suitsoft.ut.entity.IdEntity;
import com.suitsoft.ut.entity.account.User;

/**
 *学院
 *@author Suineg
 */
@Entity
@Table(name="LW_COLLEGE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class College extends IdEntity{
	/** 学院名 */
	private String collegeName;
	/** 最后操作人 */
	
	private User user;
	
	private Set<Discipline> discipline = new HashSet<Discipline>();
	/** 操作时间 */
	private Date opdate;
	
	
	
	private Set<Teacher> teachers = new HashSet<Teacher>();
	
	@OneToMany(fetch = FetchType.LAZY,mappedBy = "college")
	@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
	public Set<Teacher> getTeachers() {
		return teachers;
	}
	public void setTeachers(Set<Teacher> teachers) {
		this.teachers = teachers;
	}
	@OneToMany(fetch=FetchType.LAZY,mappedBy="college")
	@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
	public Set<Discipline> getDiscipline() {
		return discipline;
	}
	public void setDiscipline(Set<Discipline> discipline) {
		this.discipline = discipline;
	}
	public String getCollegeName() {
		return collegeName;
	}
	public void setCollegeName(String collegeName) {
		this.collegeName = collegeName;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "USER_ID")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Date getOpdate() {
		return opdate;
	}
	public void setOpdate(Date opdate) {
		this.opdate = opdate;
	}
}

